/*
 * commons is a based project implemented
 * Copyright (C) 2024 Jasmine
 */
package com.commons.uid.props;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author Jasmine
 * @version 1.0
 * @date 2020-11-25 11:01:01
 * @see WorkerNodeProperty
 * @since JDK1.8
 */
@Component
@ConfigurationProperties(prefix = "work.node")
public class WorkerNodeProperty {

    /**
     * 机器id
     */
    private Long workerId = 1L;

    /**
     * 当前时间占用位数 (28 bits)
     */
    private int timeBits = 28;

    /**
     * 机器占用位数(22 bits)，最多可支持约420w次机器启动。内置实现为在启动时由数据库分配，默认分配策略为用后即弃，后续可提供复用策略。
     */
    private int workerBits = 22;

    /**
     * 序列占用位数 (13 bits),每秒下的并发序列，13 bits可支持每秒8192个并发。
     */
    private int seqBits = 13;

    /**
     * 当前时间，相对于时间基点"2016-05-20"的增量值，单位：秒，最多可支持约8.7年
     */
    private String epochStr = "2016-05-20";

    public Long getWorkerId() {
        return workerId;
    }

    public void setWorkerId(Long workerId) {
        this.workerId = workerId;
    }

    public int getTimeBits() {
        return timeBits;
    }

    public void setTimeBits(int timeBits) {
        this.timeBits = timeBits;
    }

    public int getWorkerBits() {
        return workerBits;
    }

    public void setWorkerBits(int workerBits) {
        this.workerBits = workerBits;
    }

    public int getSeqBits() {
        return seqBits;
    }

    public void setSeqBits(int seqBits) {
        this.seqBits = seqBits;
    }

    public String getEpochStr() {
        return epochStr;
    }

    public void setEpochStr(String epochStr) {
        this.epochStr = epochStr;
    }
}
